package xdu.lz.stage2_design_pattern.chapter17_worker_thread_pattern;

public class Request {

    private final String name;

    private final int number;

    public Request(String name, int number) {
        this.name = name;
        this.number = number;
    }

    /**
     * 核心思想所在，工人调用中间件管道方法去工作！！！
     */
    public void execute(){
        //+this会调用toString方法
        System.out.println(Thread.currentThread().getName()+" take from channel : "+this);
    }

    @Override
    public String toString() {
        return "Request{" +
                "name='" + name + '\'' +
                ", number=" + number +
                '}';
    }
}
